<div class="content container">

        <!-- container -->
        <table class="table table-bordered collect-table">
            <thead>
                <tr>
                    <th>名目</th>
                    <th>截止时间</th>
                    <th>已提交/已领取</th>
                    <th>总分数</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                    <foreach name="list" item="vo" >
                        <tr>
                            <td>{$vo.title}</td>
                            <td>{$vo.tasktime}</td>
                            <td>{$vo.wccount}/{$vo.pcount}</td>
                            <td>{$vo.total}</td>
                            <td>
                                <a <if condition="$vo['fbcount']==0">class="text-primary go_a" href="{:U('User/Teacher/AddExam')}&eid={$vo.id}" <else/>class="disabled"</if> >发布作业</a>
                                <!-- <a class="text-primary">二维码</a> -->
                                <a onclick="downzip({$vo.id})" class="text-primary">下载主题附件</a>
                                <a <if condition="$vo['fbcount']==0">href="{:U('User/Teacher/ExamMark')}&eid={$vo.id}" class="text-primary" <else/>class="disabled"</if> >评卷</a>
                                <a <if condition="$vo['fbcount']==0">class="text-primary go_f" data-id="{$vo.id}" <else/>class="disabled"</if>>发布成绩</a>
                            </td>
                        </tr>
                    </foreach>
            </tbody>
        </table>
        <!-- container End -->


    </div>

        <!-- 发布试题 -->
 
        <!-- 发布成绩 -->
        <div class="modal modal-exam fade" aria-hidden="true" id="score">
            <div class="icon icon-spin loader icon-spinner-indicator"></div>
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal">×</button>
                        <h4 class="modal-title">
                            <i class="modal-icon icon-undefined"></i>
                            <span class="modal-title-name">发布成绩</span>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div class="text-center">
                            <buttom class="btn btn-primary" data-dismiss="modal">取消</buttom>
                            <buttom class="btn btn-primary">确认</buttom>
                        </div>
                    </div>
                </div>
            </div>
        </div>
 
       
        <script src="__PUBLIC__/dist/js/jquery.js"></script>
        <script>
            $(".go_a").on("click",function(){
                event.preventDefault();
                var url = window.location.origin+ $(this).attr("href");
                var myModal = new $.zui.ModalTrigger({
                    className: "modal-exam",
                    title: "发布试题",
                    size: "sm",
                    custom: '<div id="qrcode"></div><input type="text" value="'+ url +'" disabled>'
                });
                myModal.show();
                $("#qrcode").qrcode(url);
                 
            })
            $(".go_f").on("click",function(){
                event.preventDefault();
                var url =  $(this).attr("data-id");
                var myModal = new $.zui.ModalTrigger({
                    className: "modal-exam",
                    title: "发布成绩",
                    size: "sm",
                    custom: `<div class="text-center">
                            <buttom class="btn btn-primary" data-dismiss="modal">取消</buttom>
                            <buttom class="btn btn-primary" onclick="fbcj(`+url+`)">确认</buttom>
                        </div>`
                });
                myModal.show();
                
                 
            })
            function fbcj(id)
            {
                var data = {eid:id};
                var url =  "{:U('User/Teacher/relres')}";
                $.ajax({
                    type: "POST",
                    url: url,
                    data: data,
                    success: function(msg){
                         msg=JSON.parse(msg);
                      
                         alert(msg.info);
                         window.location.href="{:U('User/Teacher/TaskCollect')}";
                       
                         
                    }
                });
            }
            function downzip(id)
            {
                var data = {eid:id};
                var url =  "{:U('User/Teacher/dowmfilezip')}";
                $.ajax({
                    type: "POST",
                    url: url,
                    data: data,
                    success: function(msg){
                        var data = JSON.parse(msg)
                      
                         alert(data.info);
                         if(data.status==1)
                         {
                            
                            var file = data.data.file;
                            var elemIF = document.createElement("a");
                            elemIF.href = file;
                            // elemIF.style.display = "none";
                            elemIF.download = data.data.name;
                            // document.body.appendChild(elemIF);
                            elemIF.click();
                         }
                       
                         
                    }
                });
            }
        </script>